package com.zyf.customview;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.AppCompatSeekBar;
import android.view.View;
import android.widget.SeekBar;

import com.zyf.customview.view.CustomView;
import com.zyf.customview.view.QQCustomView;

public class MainActivity extends AppCompatActivity {
    CustomView customview;
    QQCustomView qqcustomview;
    private AppCompatSeekBar seekBar,seekBar2,seekbar3,seekbar4;
    private int progres;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        customview = (CustomView)findViewById(R.id.customview);
        qqcustomview = (QQCustomView)findViewById(R.id.qqcustomview);
        seekBar = (AppCompatSeekBar)findViewById(R.id.seekbar);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                progres = progress;
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                customview.setSteps(progres);
                qqcustomview.setSteps(progres);
            }
        });
        seekBar2 = (AppCompatSeekBar)findViewById(R.id.seekbar2);
        seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                customview.setArcStrokeWidth(progress);
                qqcustomview.setArcStrokeWidth(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
        seekbar3 = (AppCompatSeekBar)findViewById(R.id.seekbar3);
        seekbar3.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                customview.setCurrentProgress(progress);
                qqcustomview.setCurrentProgress(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
        seekbar4 = (AppCompatSeekBar)findViewById(R.id.seekbar4);
        seekbar4.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                progres = progress;
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                qqcustomview.setSpacingWidth(progres);
            }
        });
        customview.setListener(new CustomView.OnViewProgressListener() {
            @Override
            public void onProgress(int progress) {

            }
        });
        qqcustomview.setListener(new QQCustomView.OnViewProgressListener() {
            @Override
            public void onProgress(int progress) {

            }
        });
        findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this,ProgessActivity.class));
            }
        });
    }
}
